#include <iostream>
#include <string>
using namespace std;

int main()
{
	char s[1024];
	string str;
	freopen("input.txt", "r", stdin);
	freopen("instruments.conf", "w", stdout);
	while (scanf("%s", s) != EOF)
	{
		str = s;
		int k = str.find("-");
		if (k == string::npos)
		{
			printf("%s\n", str.data());
			continue;
		}
		string p = str.substr(0, k);
		string q = str.substr(k + 1);
		if (p.substr(0, p.size() - 4) != q.substr(0, q.size() - 4))
		{
			fprintf(stderr, "prefix is not the same. p=%s, q=%s\n", p.data(), q.data());
			continue;
		}
		int np, nq;
		sscanf(p.substr(p.size() - 4).c_str(), "%d", &np);
		sscanf(q.substr(q.size() - 4).c_str(), "%d", &nq);
		for (int i = np; i <= nq; ++i)
		{
			printf("%s%d\n", p.substr(0, p.size() - 4).data(), i);
		}
	}
}